<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login - Polls</title>
<style>
.error{
	color: red;
	font-weight: bold;
}
</style>
</head>
<body>
<%@include file="header.jsp" %>
<h1>Login</h1>
<%
String loginUrl = request.getContextPath()+"/Login";
%>
<form action="<%=loginUrl %>" method="POST">
	<fieldset>
		<legend>Authentication</legend>
<%
String error = (String)request.getAttribute("error");
if(error!=null && !error.isEmpty()){
%>
<div class="error"><%=error %></div>	
<%
}
%>		
		<p>
			<label for="txtUsername">Username:</label>
			<input type="text" name="username" id="txtUsername" 
			value="<%=request.getParameter("username")!=null?request.getParameter("username"):""%>"/>
		</p>
		<p>
			<label for="txtPassword">Password:</label>
			<input type="password" name="password" id="txtPassword" />
		</p>
		<p>
			<input type="reset" />
			<input type="submit" value="Login"/>
		</p>
	</fieldset>
</form>
</body>
</html>